<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
    
    <ui:composition template="/resources/templates/default.xhtml">
        <ui:define name="title">Logs</ui:define>
        <ui:define name="titlePage">Logs de #{logsBean.etudiantSelected.nom} #{logsBean.etudiantSelected.prenom}</ui:define>
        <ui:define name="cssStyle">
            <style type="text/css">
                a{
                    word-break: break-all;
                }
            </style>
        </ui:define>
        <ui:define name="content">
            <p:layout>
                <p:layoutUnit position="center">
                    <p:layout>
                        <p:layoutUnit position="north">
                            <h:form>
                                <p:panel header="Filtres">
                                    <p:panelGrid columns="3">
                                        <h:outputText style="font-weight:bold;" value="Date : "/><h:outputText value="#{logsBean.daySelected} #{logsCalendarBean.getMonthNameOf(logsBean.monthSelected)} #{logsBean.yearSelected}" /><h:outputText value=""/>
                                        <h:outputText style="font-weight:bold;" value="Heure : " rendered="#{logsBean.hourSelected != -1}"/><h:outputText value="#{logsBean.hourSelected}" rendered="#{logsBean.hourSelected != -1}" /><p:commandButton style="width:30px;" ajax="false" actionListener="#{logsBean.removeHourFilterStudent()}" icon="ui-icon-close" rendered="#{logsBean.hourSelected != -1}" />
                                        <h:outputText style="font-weight:bold;" rendered="#{topSitesBean.domainSelected != null}" value="Site : "/><h:outputText value="#{topSitesBean.domainSelected}" rendered="#{topSitesBean.domainSelected != null}" /><p:commandButton style="width:30px;" ajax="false" actionListener="#{logsBean.removeDomaineFilterStudent()}" icon="ui-icon-close" rendered="#{topSitesBean.domainSelected != null}" />
                                    </p:panelGrid>
                                </p:panel>
                            </h:form>
                        </p:layoutUnit>
                        <p:layoutUnit position="center">
                            <p:panel header="Liste des logs (#{logsBean.logs.size()})">
                                <h:form>
                                    <p:dataTable id="dataLogs" value="#{logsBean.logs}" paginator="true" rows="200" emptyMessage="Aucun logs" var="log">
                                        <p:column headerText="HEURE">
                                            #{log.timeString}
                                        </p:column>

                                        <p:column headerText="IP">
                                            #{log.ip}
                                        </p:column>

                                        <p:column headerText="DOMAINE" rendered="#{topSitesBean.domainSelected == null}">
                                            <h:commandLink action="topsite_users" value="#{log.domaine}">
                                                <f:setPropertyActionListener target="#{topSitesBean.domainSelected}" value="#{log.domaine}" />
                                            </h:commandLink>
                                        </p:column>

                                        <p:column headerText="URL">
                                            <a target="_blank" href="#{log.url}">#{log.url}</a>
                                        </p:column>
                                    </p:dataTable>
                                </h:form>
                            </p:panel>
                        </p:layoutUnit>
                    </p:layout>
                </p:layoutUnit>
            </p:layout>
            
        </ui:define>

    </ui:composition>
</html>
